package com.qianzhu8.kfc.boot.config;

import com.qianzhu8.kfc.boot.client.KfcExecuteClient;
import com.qianzhu8.kfc.boot.factory.KfcExecuteFactory;
import com.qianzhu8.kfc.boot.factory.KfcExecuteFactoryImpl;
import com.qianzhu8.kfc.boot.props.KfcProperty;
import lombok.AllArgsConstructor;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * KfcAutoConfiguration
 *
 * @author xuyanjun
 * @date 2020-04-12
 */
@AllArgsConstructor
@Configuration
@EnableConfigurationProperties(KfcProperty.class)
public class KfcAutoConfiguration {

    private KfcProperty kfcProperty;

    @Bean
    public KfcExecuteClient kfcExecuteClient() {
        KfcExecuteFactory factory = new KfcExecuteFactoryImpl();
        return factory.createExecuteClient(kfcProperty);
    }
}
